public class MyThread extends Thread {
    public void run(){
        System.out.println(this.getName()+"执行");
    }
}
class MyThread2 implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"执行");
    }
}

class Demo1 {
    public static void main(String[] args) {
        Thread t1 = new MyThread();
        Thread t2 = new Thread(new MyThread2(),"zxt");
        Thread t3 = new Thread(){
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+"执行");
            }
        };
        Thread t4 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+"执行");
            }
        },"zxt2");
        Thread t5 = new Thread(()->{
            System.out.println(Thread.currentThread().getName()+"执行");
        });
        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }
}
